<template>
    <div style="background-color: antiquewhite;border: 1px solid orange;padding: 5px;">
        我是子孙组件
        <span style="color: red;">{{ props.parentData1 }}</span>
        <span style="color: blue;">{{ parentData2 }}</span>
    </div>
</template>

<script setup>
import { inject } from 'vue';

const props = defineEmits({
    parentData1:String
})
const parentData2=inject('parentData2')
</script>

<style scoped>

</style>